<script setup lang="ts">
import { ref } from "vue";

const payPopup = ref();

defineProps(["code", "onClose"]);
defineExpose({
  open: () => {
    payPopup.value.open();
  },
  close: () => {
    payPopup.value.close();
  }
});
</script>

<template>
  <uv-popup ref="payPopup" mode="center" bgColor="none" zIndex="999">
    <view class="kefu-container">
      <view class="title">支付</view>
      <view class="kefu-code">
        <uv-image
          :src="code"
          mode="aspectFit"
          :fade="false"
          width="190"
          height="190"
          class="code"
        ></uv-image>
        <view class="btn"> 请使用微信扫码支付 </view>
        <view class="tip">完成支付后，请刷新页面</view>
      </view>
    </view>
    <view class="icon_close" @click.stop="payPopup.close"></view>
  </uv-popup>
</template>

<style lang="scss" scoped>
.icon_robot {
  display: block;
  margin: 0 auto -60px;
  width: 120px;
  height: 108px;
  background-image: url("https://wealth-1311286543.cos.ap-guangzhou.myqcloud.com/taoshe/static/icon_robot.png");
  background-size: cover;
  z-index: 1;
  position: relative;
}

.icon_close {
  width: 40px;
  height: 40px;
  background-image: url("https://wealth-1311286543.cos.ap-guangzhou.myqcloud.com/taoshe/static/icon_close.png");
  background-size: cover;
  margin: 10px auto 0;
}
.kefu-container {
  width: 290px;
  background-color: #495bff;
  border-radius: 20px;
  box-sizing: border-box;
  overflow: hidden;

  .tip {
    text-align: center;
    font-size: 24rpx;
    color: #6c6d7b;
    margin-top: 10rpx;
  }
  .title {
    margin: 20px auto 10px;
    text-align: center;
    color: #fff;
  }

  .kefu-code {
    width: 270px;
    margin: 20px 10px;
    overflow: hidden;
    background-color: #fff;
    border-radius: 20px;

    .code {
      margin: 20rpx auto;
    }

    .btn {
      width: 230px;
      height: 40px;
      line-height: 40px;
      border-radius: 10px;
      margin: 0 20px;
      background-color: #333;
      color: #fff;
      font-size: 14px;
      text-align: center;
    }
  }
}
</style>
